package com.td.client.gui.frame;

import java.util.ArrayList;

import mdes.slick.sui.ToggleButton;
import mdes.slick.sui.Window;
import mdes.slick.sui.event.MouseEvent;
import mdes.slick.sui.event.MouseListener;

import org.newdawn.slick.Color;

public abstract class AbstractWindow extends Window{

	protected Frame frame;
	
	public AbstractWindow(Frame frame) {
		
		this.frame = frame;
		
		this.addMouseListener(new FrameMouseListener());
		this.setOpaque(true);
		this.setBackground(Color.lightGray);	
		this.setSize(800, 100);
		this.setLocation(Frame.FRAME_X, Frame.FRAME_Y);
		this.setAlwaysOnTop(true);
		
		buildGUI();
		
	}
	
	protected abstract void buildGUI();
	
	protected abstract void unselectAllButtons();
	
	protected void unselectButtons(ArrayList<ToggleButton> buttons, ToggleButton thisButton) {
		
		for(ToggleButton b : buttons)
			if(!b.equals(thisButton))
				b.setSelected(false);
	}
		
	protected class FrameMouseListener implements MouseListener {

		@Override
		public void mouseDragged(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseEntered(MouseEvent arg0) {
			frame.setMouseOnFrame(true);
		}

		@Override
		public void mouseExited(MouseEvent arg0) {
			frame.setMouseOnFrame(false);
		}

		@Override
		public void mouseMoved(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mousePressed(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseReleased(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}
		
	}
}
